package com.chtw.vuedemo.controller;

import com.chtw.vuedemo.bean.Swipe;
import com.chtw.vuedemo.response.RespUtil;
import com.chtw.vuedemo.response.enumutil.CodeAndMsg;
import com.chtw.vuedemo.service.impl.SwipeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author chtw
 * @date 2020-10-03 20:41
 */
@RestController
@RequestMapping("/swipe")
public class SwipeController {

    @Autowired
    private SwipeServiceImpl swipeService;

    @GetMapping(value = "/list")
    public RespUtil<List<Swipe>> list(){
        try{
            return new RespUtil<>(CodeAndMsg.SUCCESS, swipeService.list());
        }catch (Exception e){
            return new RespUtil<>(CodeAndMsg.FAIL, null);
        }
    }
}
